<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" data-rule="required;" placeholder="請上傳圖片" size="50" name="row[image]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">跳轉類型:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                <label for="row[type_dian]-0">
                    <input id="row[type_dian]-0" name="row[type]" type="radio" value="0" onclick="selectType(this)"  checked/> 無
                </label>
                <label for="row[type_dian]-1">
                    <input id="row[type_dian]-1" name="row[type]" type="radio" value="1" onclick="selectType(this)"> 大灣區資訊
                </label>
                <label for="row[type_dian]-2">
                    <input id="row[type_dian]-2" name="row[type]" type="radio" value="2" onclick="selectType(this)"> 大灣區調查
                </label>
                <label for="row[type_dian]-3">
                    <input id="row[type_dian]-3" name="row[type]" type="radio" value="3" onclick="selectType(this)"> 工聯中心
                </label>
                <label for="row[type_dian]-4">
                    <input id="row[type_dian]-4" name="row[type]" type="radio" value="4" onclick="selectType(this)"> 互助廣場
                </label>
                <label for="row[type_dian]-5">
                    <input id="row[type_dian]-5" name="row[type]" type="radio" value="5" onclick="selectType(this)"> 義工報名
                </label>
                <label for="row[type_dian]-6">
                    <input id="row[type_dian]-6" name="row[type]" type="radio" value="6" onclick="selectType(this)"> 招聘報名
                </label>
                <label for="row[type_dian]-7">
                    <input id="row[type_dian]-7" name="row[type]" type="radio" value="7" onclick="selectType(this)"> 商品
                </label>
                <label for="row[type_dian]-8">
                    <input id="row[type_dian]-8" name="row[type]" type="radio" value="8" onclick="selectType(this)"> 積分商品
                </label>
                <label for="row[type_dian]-9">
                    <input id="row[type_dian]-9" name="row[type]" type="radio" value="9" onclick="selectType(this)"> 活動
                </label>
            </div>
        </div>
    </div>
    <div class="form-group" id="relation_id_div" style="display: none;" >
        <label class="control-label col-xs-12 col-sm-2">跳轉關聯ID:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-relation_id" data-rule="" class="form-control" name="row[relation_id]" type="number" placeholder="請輸入相關ID">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">

    function selectType(obj) {
        var type_status = $("input[name='row[type]']:checked").val();
        if ( type_status>0 ) {
            $("#relation_id_div").show();
        }else{
            $("#relation_id_div").hide();
        }
    }
</script>